package org.example.doctorapi.server.Imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.micrometer.common.util.StringUtils;
import org.example.doctorapi.data.SysDictData;
import org.example.doctorapi.data.SysDictType;
import org.example.doctorapi.data.SysLoginInfo;
import org.example.doctorapi.mapper.SysDictTypeMapper;
import org.example.doctorapi.server.SysDictTypeServer;
import org.example.doctorapi.util.IdGeneration;
import org.springframework.beans.factory.annotation.Autowired;

public class SysDictTypeServerImp implements SysDictTypeServer {
    @Autowired
    private SysDictTypeMapper sysDictTypeMapper;
    private static final IdGeneration<SysDictType> idGeneration = new IdGeneration<>();
    @Override
    public Page<SysDictType> listForPage(SysDictType sysDictType) {
        QueryWrapper<SysDictType> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(sysDictType.getDictName()),SysDictType.DICT_NAME,sysDictType.getDictName());
        queryWrapper.eq(StringUtils.isNotBlank(sysDictType.getStatus()),SysDictType.STATUS,sysDictType.getStatus());
        return idGeneration.GetRecords(sysDictType, queryWrapper, sysDictTypeMapper);
    }
}
